package com.advaita.util;

import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ItemListener;

import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;
import javax.swing.ButtonModel;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JRadioButton;
import javax.swing.event.ChangeListener;

public class StaticButtonModel implements ButtonModel {
	private boolean selected;

	public StaticButtonModel(boolean isSelected) {
		selected = isSelected;
	}

	public boolean isSelected() {
		return selected;
	}

	// empty method implementations
	public boolean isArmed() {
		return false;
	}

	public boolean isEnabled() {
		return true;
	}

	public boolean isPressed() {
		return false;
	}

	public boolean isRollover() {
		return false;
	}

	public void setArmed(boolean b) {
	}

	public void setEnabled(boolean b) {
	}

	public void setPressed(boolean b) {
	}

	public void setRollover(boolean b) {
	}

	public void setSelected(boolean b) {
	}

	public void setActionCommand(String s) {
	}

	public void setGroup(ButtonGroup group) {
	}

	public void setMnemonic(int key) {
	}

	public String getActionCommand() {
		return "static";
	}

	public int getMnemonic() {
		return java.awt.event.KeyEvent.VK_UNDEFINED;
	}

	public Object[] getSelectedObjects() {
		return null;
	}

	public void addActionListener(ActionListener l) {
	}

	public void addChangeListener(ChangeListener l) {
	}

	public void addItemListener(ItemListener l) {
	}

	public void removeActionListener(ActionListener l) {
	}

	public void removeChangeListener(ChangeListener l) {
	}

	public void removeItemListener(ItemListener l) {
	}

	public static void main(String[] argv) {
		AbstractButton b1 = new JRadioButton("foo");
		b1.setModel(new StaticButtonModel(false));
		AbstractButton b2 = new JRadioButton("bar");
		b2.setModel(new StaticButtonModel(true));
		AbstractButton b3 = new JCheckBox("baz");
		b3.setModel(new StaticButtonModel(false));
		AbstractButton b4 = new JCheckBox("ola");
		b4.setModel(new StaticButtonModel(true));

		JFrame f = new JFrame("StaticButtonModel");
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.getContentPane().setLayout(new FlowLayout());
		f.getContentPane().add(b1);
		f.getContentPane().add(b2);
		f.getContentPane().add(b3);
		f.getContentPane().add(b4);
		f.setSize(300, 100);
		f.setVisible(true);
	}
}